home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / Dots & Pixels / headers / macutilities.h < prev    next >
C/C++ Source or Header  |  1995-09-29  |  3KB  |  90 lines

  1. #pragma once
  2. //
  3. // set_settingsfile sets 'settingsfile' to the name of the settingsfile to use.
  4. //
  5. // If no files are dropped on the application the existence of the file named
  6. // settingsfile is tested. If this fails a TEXT file of creator creator is made
  7. // and TEXT resource 128 is written to the file.
  8. //
  9. // If one file is dropped on the application 'settingsfile' is set to the name
  10. // of that file.
  11. //
  12. void set_settingsfile( char *settingsfile, const OSType creator);
  13. //
  14. // TwoBitColorMode returns the mode for which the given gDevice can be set in two-bit
  15. // color mode with a color look-up table. If the device doesn't support such a mode
  16. // zero is returned.
  17. //
  18. // GetIxDevice returns a GDHandle and a mode for the GDevice 'monitorno' in the
  19. // device list, if a the GDevice supports _colors_ with a Color lookuptable at
  20. // the bit depth specified.
  21. //
  22. int TwoBitColorMode( const GDHandle thedevice);
  23. int GetIxDevice( const int monitorno, GDHandle &theGDevice, short &themode, short bitDepth = 2);
  24. void load_clut( const int resno);
  25. //
  26. // The two 'realtime' functions use a system trap which is not (yet) officially
  27. // supported by Apple. However:
  28. //
  29. //    Newsgroups: comp.sys.mac.programmer
  30. //    Path: ruu.nl!news.nic.surfnet.nl!sun4nl!EU.net!uknet!pipex!howland.reston.ans.net!cs.utexas.edu!koriel!olivea!apple.com!gallant.apple.com!news
  31. //    From: Dave Falkenburg <falken@apple.com>
  32. //    Subject: Re: _MicroSeconds trap
  33. //    Sender: news@gallant.apple.com
  34. //    Message-ID: <1994Feb10.174754.25507@gallant.apple.com>
  35. //    X-Useragent: Version 1.1.3
  36. //    Date: Thu, 10 Feb 1994 17:47:54 GMT
  37. //    X-Xxdate: Thu, 10 Feb 94 17:47:48 GMT
  38. //    References: <1994Feb8.115024.25046@waikato.ac.nz>
  39. //    Organization: Apple Computer, Inc.
  40. //    Lines: 29
  41. //    
  42. //    In article <absurd-070294164939@17.202.12.60> Tim Dierks,
  43. //    absurd@apple.com writes:
  44. //    > While this may have leaked out in some sample code, let me publicly state
  45. //    > that this trap is not documented and may stop working at any moment. If
  46. //    > this isn't considered persuasive, please read the message I'm about to post
  47. //    > entitled "Undocumented System functionality and you".
  48. //    > 
  49. //    > Tim Dierks                                               
  50. //    absurd@apple.com
  51. //    
  52. //    Guess what Tim: it IS documented now.
  53. //    
  54. //    It has been moved into the public interfaces as part of the universal
  55. //    headers for PowerPC.  Someone internally decided that since QuickTime has
  56. //    been beating the living crap out of this trap, it must be working. It
  57. //    also isn't that hard to implement in the future either.
  58. //    
  59. //    From the latest <Timer.h> in the Universal Headers:
  60. //    
  61. //    extern pascal void Microseconds(UnsignedWide *microTickCount)
  62. //     FOURWORDINLINE(0xA193, 0x225F, 0x22C8, 0x2280);
  63. //    
  64. //    The pain is that this trap returns a 64-bit value.
  65. //    
  66. //    -Dave Falkenburg
  67. //    -PowerPC System Software
  68. //    -Apple Computer, Inc.
  69. //
  70. #ifdef __CONDITIONALMACROS__
  71.     #include <Timer.h>
  72.     inline unsigned long readMicroseconds()
  73.     {
  74.         UnsignedWide a_wide;
  75.         Microseconds( &a_wide);
  76.         return a_wide.lo;
  77.     }
  78. #else
  79.     pascal void readMicroseconds( unsigned long *twoLongs) =
  80.     {
  81.         0xA193, 0x225F, 0x22C8, 0x2280
  82.     };
  83.     inline unsigned long readMicroseconds()
  84.     {
  85.         unsigned long two_longs[ 2];
  86.         readMicroseconds( two_longs);
  87.         return two_longs[ 1];
  88.     }
  89. #endif
  90.